import request from '@/config/axios'

// 食谱菜单 VO
export interface MenuVO {
  id: number // 编号
  pid: number // 父ID
  name: string // 名字
  description: string // 描述
  sort: number // 显示顺序
  status: number // 状态
}

// 食谱菜单 API
export const MenuApi = {
  // 查询食谱菜单分页
  getMenuPage: async (params: any) => {
    return await request.get({ url: `/cook/menu/page`, params })
  },

  // 查询食谱菜单详情
  getMenu: async (id: number) => {
    return await request.get({ url: `/cook/menu/get?id=` + id })
  },

  // 新增食谱菜单
  createMenu: async (data: MenuVO) => {
    return await request.post({ url: `/cook/menu/create`, data })
  },

  // 修改食谱菜单
  updateMenu: async (data: MenuVO) => {
    return await request.put({ url: `/cook/menu/update`, data })
  },

  // 删除食谱菜单
  deleteMenu: async (id: number) => {
    return await request.delete({ url: `/cook/menu/delete?id=` + id })
  },

  // 导出食谱菜单 Excel
  exportMenu: async (params) => {
    return await request.download({ url: `/cook/menu/export-excel`, params })
  },
}